using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Input.Touch;
using Microsoft.Xna.Framework.Media;

namespace GalaxyDefenderChaos
{
    public class SoundCenter
    {
        bool _IsSoundOn = true;

        public bool IsSoundOn
        {
            get { return _IsSoundOn; }
            set 
            {
                _IsSoundOn = value;
                if (_IsSoundOn)
                    resumeLoopSound();
                else
                    pauseLoopSound();
            }
        }

        public void playSoundEffect(SoundEffect soundEffect)
        {
            if(IsSoundOn)
                soundEffect.Play();
        }

        public void playLoopSound(Song song)
        {
            if (IsSoundOn)
            {
                MediaPlayer.IsRepeating = true;
                MediaPlayer.Play(song);
            }
        }

        public void pauseLoopSound()
        {
            MediaPlayer.Pause();
        }

        public void resumeLoopSound()
        {
            MediaPlayer.Resume();
        }
    }
}
